<HTML><HEAD><TITLE>statsample(+ProfileName, +SamplePeriod, +Statistics, +File)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(instprofile)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>statsample(+ProfileName, +SamplePeriod, +Statistics, +File)</H1>
Create a statistics sampling profile.
<DL>
<DT><EM>ProfileName</EM></DT>
<DD>Atom or string
</DD>
<DT><EM>SamplePeriod</EM></DT>
<DD>Number
</DD>
<DT><EM>Statistics</EM></DT>
<DD>List of statistic keywords
</DD>
<DT><EM>File</EM></DT>
<DD>Atom or string
</DD>
</DL>
<H2>Description</H2>
<P>    
   The predicate defines a profile, ProfileName, for use by the sampling
   profiler. Samples of the statistics (statistics/2 metric keywords)
   specified in Statistics are collected every SamplePeriod seconds and 
   stored in File. The format of file is such that it can easily be
   analysed or graphed offline.
   </P><P>
   The sample based profiler is implemented using after events and is
   therefore less intrusive in its effect on the performance of the 
   executing code than the instrumentation profiler. However, it is used to
   indicate the trend of resource usage over time of a running program not to
   attribute specific costs of a statistic to a specific piece of code. The
   instrumentation based profiler is used to do this.
   </P>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Fail Conditions</H3>
Statistics is empty or contains an invalid statistic/2 keyword.
<H3>Resatisfiable</H3>
no
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>File is not an atom or string
</DL>
<H2>Examples</H2>
<PRE>
   [eclipse 1]: instprofile:statsample(memory, 5, [global_stack_used,
                                       trail_stack_used], 'memory_sample.dat').
   string     compiled traceable 476 bytes in 0.00 seconds

   Yes (0.01s cpu)
   </PRE>
<H2>See Also</H2>
<A HREF="../../lib/instprofile/statsample_control-2.html">statsample_control / 2</A>, <A HREF="../../kernel/env/statistics-2.html">statistics / 2</A>, <A HREF="../../lib/instprofile/index.html">library(instprofile)</A>
</BODY></HTML>
